using System;
using System.IO;

namespace MediaWikiEngine.Domain
{
	public class FileDescription
	{
		public string Filename;
		public string Mimetype;
		public byte[] Data;

		public FileDescription(string path, string mimetype)
		{
			Filename = Path.GetFileName(path).Replace(" ","_");
			Mimetype = mimetype;
			FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read);
			BinaryReader br = new BinaryReader(file);
			if (file.Length > int.MaxValue)
				throw new ApplicationException("File too big!");

			Data = br.ReadBytes((int) file.Length);

			br.Close();
		}
	}
}
